Summary
The both curse and blessing of modern C/C++ code is the absolute control over memory it gives the programmer. This comes as a doubled edged sword:
- the stack is just an array: we can modify and access it with
pushandpop, but also by using the special stack registers,espandebp - direct access to the return address of the function at
ebp + 4 - direct access to the parameters, found either in registers or on stack, at
ebp + 8,ebp + 12,ebp + 16etc
making the program vulnerable to ROP attacks.